﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HUBS1.HCMS.Entity;
using HUBS1.HCMS.Data;

namespace HUBS1.HCMS.SqlClient
{
    public class sql_aircode
    {
        public List<aircode> getallitem(string cityword)
        {
            string sqlstr = "select * from aircode";
            if (cityword != "")
                sqlstr += " where code like '%"+cityword+"%' or name_e like '%"+cityword+"%' or name like '%"+cityword+"%'";

            return ExecSql.GetTableList<aircode>(sqlstr);
        }

        public aircode getitem(string code)
        {
            try
            {
                return ExecSql.GetTableList<aircode>("select * from aircode where code='"+code+"'")[0];
            }
            catch { return null; }
        }

        public bool deleteitem(int id)
        {
            return false;
        }

        public bool insertorupdate(aircode _aircode)
        {
            return ExecSql.InsertOrUpdateData<aircode>(_aircode);
        }

    }
}
